package com.lib.util;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

/**
 * @author qinbaowei
 * @createtime 2017/04/07 13:22
 * @email qbaowei@qq.com
 * @description
 */


public class ApkUtil {

    public static ApplicationInfo getApkInfo(Context context, String apkPath) {
        PackageManager packageManager = context.getPackageManager();
        PackageInfo packageInfo = packageManager.getPackageArchiveInfo(apkPath,
                                                                       PackageManager.GET_ACTIVITIES);
        if (packageInfo != null) {
            return packageInfo.applicationInfo;
        }
        return null;
    }
}
